package com.park.common.poo;

import com.park.common.util.DateUtil;

import javax.persistence.*;
import java.math.BigDecimal;

import static javax.persistence.GenerationType.IDENTITY;

/**
 * Created by Administrator on 2017-07-02.
 */
@Entity
@Table(name = "config", schema = "", catalog = "totem")
public class Config {
    private int id;
    private BigDecimal firstLevel;
    private BigDecimal secondLevel;
    private BigDecimal thirdLevel;
    private String createTime = DateUtil.getNowDate();
    private String updateTime = DateUtil.getNowDate();

    @Id
    @GeneratedValue(strategy = IDENTITY)
    @Column(name = "id")
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Basic
    @Column(name = "firstLevel")
    public BigDecimal getFirstLevel() {
        return firstLevel;
    }

    public void setFirstLevel(BigDecimal firstLevel) {
        this.firstLevel = firstLevel;
    }

    @Basic
    @Column(name = "secondLevel")
    public BigDecimal getSecondLevel() {
        return secondLevel;
    }

    public void setSecondLevel(BigDecimal secondLevel) {
        this.secondLevel = secondLevel;
    }

    @Basic
    @Column(name = "thirdLevel")
    public BigDecimal getThirdLevel() {
        return thirdLevel;
    }

    public void setThirdLevel(BigDecimal thirdLevel) {
        this.thirdLevel = thirdLevel;
    }

    @Basic
    @Column(name = "createTime")
    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    @Basic
    @Column(name = "updateTime")
    public String getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(String updateTime) {
        this.updateTime = updateTime;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Config config = (Config) o;

        if (id != config.id) return false;
        if (firstLevel != null ? !firstLevel.equals(config.firstLevel) : config.firstLevel != null) return false;
        if (secondLevel != null ? !secondLevel.equals(config.secondLevel) : config.secondLevel != null) return false;
        if (thirdLevel != null ? !thirdLevel.equals(config.thirdLevel) : config.thirdLevel != null) return false;
        if (createTime != null ? !createTime.equals(config.createTime) : config.createTime != null) return false;
        if (updateTime != null ? !updateTime.equals(config.updateTime) : config.updateTime != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id;
        result = 31 * result + (firstLevel != null ? firstLevel.hashCode() : 0);
        result = 31 * result + (secondLevel != null ? secondLevel.hashCode() : 0);
        result = 31 * result + (thirdLevel != null ? thirdLevel.hashCode() : 0);
        result = 31 * result + (createTime != null ? createTime.hashCode() : 0);
        result = 31 * result + (updateTime != null ? updateTime.hashCode() : 0);
        return result;
    }
}
